package sw.controller;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import sw.entity.College;
import sw.entity.Test;

@Controller
@RequestMapping("/college")
public class CollegeControllerdemo {
	//自动注入一个CollegeRepo数据存取接口对象
/*	@Autowired
	private CollegeRepo collegeRepo;
	
	//显示学院列表视图
	@GetMapping()
	public String showCollegePage(Model model){
		Iterable<College> college=collegeRepo.findAll();
		model.addAttribute("colleges",college);
	}*/
	
/*	@GetMapping("/college/college")
	@ResponseBody
	public College showGetcollege(){
		College college = new College(); 
		college.setId(1);
		college.setName("商学院");
		college.setDescribe("商业");
		//college.setbuildTime(LocalDate.now());
		return college;
	}
	
	@GetMapping("/college/html2")
	@ResponseBody
	public College showCollege(){
		College college = new College(1,"软件工程学院","xxx",null);
		return college; 
	} 
	
	@GetMapping("college/html3")
	@ResponseBody
	public Date getLocaldate(){ 
		return new Date( );	   
	}
	@GetMapping("/college/html1")
	@ResponseBody
	public Test showTest(){
		Test test=new Test(25,"黎炎逸","男");
		return test;
	}*/
	
//	@GetMapping("/colleges")
//	public String colleges(Model model){
//		List<College> collegeList = new ArrayList<College>();
//		College oldCollege = new College(1,"商学院",null,LocalDate.of(1990, 10, 1));
//		collegeList.add(oldCollege);
		//	model.addAttribute("demo",oldCollege);
	//	Test newTest = new Test(18,"黎炎逸","男");
	//	model.addAttribute("demo1",newTest);
//		collegeList.add(new College(2,"软件工程学院",null,LocalDate.of(1991,10,1)));	
	//	model.addAttribute("demo2", newCollege);
//		collegeList.add(new College(3,"土木工程学院",null,LocalDate.of(1890,5,10)));
//		model.addAttribute("demo3",collegeList);
//		return "html1";
	}
//}


